<template>
  <BaseMainSlot :show-tab="true">
    <template v-slot:search-box>
      <SearchForm :formConfig="formConfig" :formData="searchlist" @search="search"></SearchForm>
    </template>
    <template v-slot:btn-box>
      <ActionBar
        :page-no="76"
        :add-active="forderStatus === 0"
        :del-active="delActive"
        :has-edit="false"
        :has-save="false"
        :has-cancel="false"
        @add="add"
        @del="del"
      />
    </template>
    <template v-slot:tab-select>
      <selectbutton
        :buttonselectlist="buttonselectlist"
        @nowselectbuttonindex="nowselectbuttonindex"
      />
    </template>
    <template v-slot:table-box>
      <Table @sortChange="changeTableSort" :propList="tableColumn" v-loading="loading"
        :listData="tableData" @handleSelectionChange="handleSelectionChange">

        <template v-slot:operation="{ row }">
          <template v-if="!row.index">
            <el-button
              v-if="judgePermission(76, 'edit') && forderStatus === 0"
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="edit(row,'auditing')"
            >
              <i class="el-icon-edit-outline"></i> 审核
            </el-button>
            <el-button
              v-if="judgePermission(76, 'edit') && forderStatus === 0"
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="edit(row,'reject') "
            >
              <i class="el-icon-edit-outline"></i> 驳回
            </el-button>
           <!--  <el-button
              v-if="judgePermission(76, 'delete') && forderStatus === 0"
              class="text-btn-cursor cursor-delete"
              type="text"
              size="small"
              @click="handleDelete(row.warehousingEntryNo)"
            >
              <i class="el-icon-delete"></i> 删除
            </el-button> -->
             <el-button
              v-if="judgePermission(76, 'edit') && forderStatus == 1"
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="edit(row,'check')"
            >
              <i class="el-icon-view"></i>查看详情
            </el-button>
            <el-button
              v-if="judgePermission(76, 'edit') && forderStatus == 2"
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="edit(row,'reject')"
            >
              <i class="el-icon-view"></i>驳回原因
            </el-button>
          </template>
        </template>
        <template v-slot:materialInfo="{ row }">
          <template v-if="!row.index">
            <el-button
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="edit(row,'material')"
            >
              <i class="el-icon-view"></i>查看详情
            </el-button>
          </template>
        </template>
        <template v-slot:viewList="{ row }">
          <template v-if="!row.index">
            <el-button
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="kookInfo(row.warehousingEntryNo)"
            >
              <i class="el-icon-view"></i>查看到货明细
            </el-button>
          </template>
        </template>
        <template v-slot:typeFlag="{ row, item }">
          <template v-if="!row.index">
            {{ getEntryType(row[item.prop]) }}
          </template>
        </template>
        <template v-slot:castUnit="{ row, item }">
          <template v-if="!row.index">
            {{ row.shouldArriveNum }} {{ row[item.prop].symbol || row[item.prop].unitName }}
          </template>
        </template>
        <template v-slot:unit="{ row, item }">
          <template v-if="!row.index">
            {{ row.primaryQuantity }} {{ row[item.prop].symbol || row[item.prop].unitName }}
          </template>
        </template>
      </Table>
      <Pagination
        :page-size="pageSize"
        :current-page="currentPage"
        :total-size="totalSize"
        @changePageSize="changePageSize"
        @changeCurrentPage="changeCurrentPage"
      />
    </template>
    <template v-slot:dialog>
      <el-dialog
        :title="titleText"
        :visible.sync="dialogFormVisible"
        @close="cancel('formData')"
      >
        <div v-if="nowChanceStau==='reject' ">
          <div class="input-row" style="display: flex; align-items: center; margin-top: 20px;">
          <label for="rejectReason" style="margin-right: 10px;">驳回原因：</label>
          <el-input
            id="rejectReason"
            type="textarea"
            v-model="formData.reason"
            rows="4"
            :disabled="forderStatus===2"
            style="flex: 1;">
          </el-input>
        </div>
        </div>
        <el-form
          ref="formData"
          label-position="left"
          :model="formData"
          :rules="rules"
          class="el-form"
          v-if="nowChanceStau!=='reject' "
        >
        <el-form-item v-if="nowChanceStau !== 'material' " label="入库形式 :" class="w100p">
            <el-button v-if="typeFlag === 0 || nowChanceStau === 'add'" :type="typeFlag === 0 ? 'primary' : ''"     :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'"@click="changeAddWays(0)">订单入库</el-button>
            <el-button v-if="typeFlag === 1 || nowChanceStau === 'add'" :type="typeFlag === 1 ? 'primary' : ''" :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'"  @click="changeAddWays(1)">自行入库</el-button>
            <el-button v-if="typeFlag === 2  " :type="typeFlag === 2 ? 'primary' : ''"     :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'">产品入库</el-button>
            <el-button v-if="typeFlag === 3 " :type="typeFlag === 3 ? 'primary' : ''" :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'">原料退库</el-button>
            <el-button v-if="typeFlag === 4 " :type="typeFlag === 4 ? 'primary' : ''" :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'">调拨入库</el-button>
            <el-button v-if="typeFlag === 5 " :type="typeFlag === 5 ? 'primary' : ''" :disabled="nowChanceStau === 'auditing'|| nowChanceStau === 'check'">委托加工入库</el-button>
        </el-form-item>

          <el-form-item
            v-if="typeFlag === 0 && nowChanceStau === 'add'"
            label="源头单据类型 :"
            prop="sourceDocType"
            class="w50p"
            :rules="[{required: true,message:'源头单据类型不能为空',trigger:'change'}]"
          >
            <el-select
              v-model="formData.sourceDocType"
              placeholder="请选择源头单据类型"
              clearable
            >
              <el-option
                v-for="items,indexs in sourceDocTypeList"
                :key="indexs"
                :label="items.name"
                :value="items.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            v-if="typeFlag === 0 && nowChanceStau === 'add'"
            label="源头单号 :"
            prop="sourceDocNo"
            class="w50p"
            :rules="[{required: true,message:'源头单明细号不能为空',trigger:'change'}]"
          >
            <el-select
              v-model="formData.sourceDocNo"
              placeholder="请选择源头单号"
              clearable
              @change="getOrderDetailList"
            >
              <el-option
                v-for="items,indexs in sourceDocNoList"
                :key="indexs"
                :label="items.orderNo"
                :value="items.orderNo"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            v-if="nowChanceStau === 'add' && typeFlag === 0"
            label="选择入库商品 :"
            class="w100p"
          >
            <el-checkbox-group
              v-model="formData.arrivalGoodsList"
              @change="chooseGoods"
            >
              <el-checkbox
                v-for="items,indexs in arrivalGoodsList"
                :key="indexs"
                :label="items"
              >{{ items.materialName }}</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item
              label="入库单号："
              v-if="nowChanceStau!=='add'"
              class="w50p"
              prop="warehousingEntryNo"
              :rules="[{required: true, message: '入库单号不能为空', trigger: 'change'}]"
            >
              <el-input
                clearable
                v-model="formData.warehousingEntryNo"
                placeholder="请输入入库单号"
                disabled
              />
            </el-form-item>
          <el-form-item
              label="入库时间 :"
              v-if="nowChanceStau==='check'|| nowChanceStau==='auditing' "
              prop="intoTime"
              class="w50p"
              :rules="[{required: true,message:'到货不能为空',trigger:'change'}]"
            >
              <el-date-picker
                v-model="formData.intoTime"
                :picker-options="putInDate(0)"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm"
                format="yyyy-MM-dd HH:mm"
                clearable
                :disabled="nowChanceStau === 'material' || nowChanceStau==='check' "
                placeholder="请选择时间"
              />
            </el-form-item>
          <div
            v-for="orderDetail,index in formData.putInStorageList"
            :key="orderDetail.key"
            class="w100p xunhuan"
          >
            <div  class="goods">入库货{{ index + 1 }}</div>
            <el-form-item
              label="入库货名 :"
              :prop="'putInStorageList.' + index + '.materialNo'"
              class="w50p"
              :rules="[{required: true,message:'入库货名不能为空',trigger:'change'}]"
            >
              <el-select
                v-model="orderDetail.materialNo"
                placeholder="请选择入库货名称"
                clearable
                :disabled="nowChanceStau !== 'add' "
                @change="getGoods($event,index)"
              >
                <el-option
                  v-for="items,indexs in materialList"
                  :key="indexs"
                  :label="items.materialName"
                  :value="items.materialNo"
                />
              </el-select>
            </el-form-item>
             <el-form-item
              label="行号 :"
              :prop="'putInStorageList.' + index + '.linenumber'"
              class="w50p"
              >
              <el-input
              clearable

              :value=index+1
              placeholder="行号"
              :disabled="true"
          />
            </el-form-item>
            <el-form-item
              label="入库数量 :"
              :prop="'putInStorageList.' + index + '.shouldArriveNum'"
              class="w50p numberUnit"
              :rules="[{required: true,message:'数量不能为空',trigger:'blur'},{pattern: /^\d+$/,message:'值该为正整数',trigger: ['change','blur']},
              ]"
            >
              <el-input
                v-model="orderDetail.shouldArriveNum"
                clearable
                placeholder="请输入应到数量"
                :disabled="nowChanceStau !== 'add' "
                class="one"
              />
              <el-select
                v-model="orderDetail.castUnitNo"
                placeholder="单位"
                class="two"
                clearable
                disabled
              >
                <el-option
                  v-for="items,indexs in unitList"
                  :key="indexs"
                  :label="items.symbol || items.unitName"
                  :value="items.unitNo"
                />
              </el-select>
            </el-form-item>
            <el-form-item
              label="入货仓库 :"
              :prop="'putInStorageList.' + index + '.stordocNo'"
              class="w50p"
              :rules="[{required: true,message:'入货仓库不能为空',trigger:'change'}]"
            >
              <el-select
                v-model="orderDetail.stordocNo"
                placeholder="请选择入货仓库"
                clearable
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
              >
                <el-option
                  v-for="items,indexs in stordocList"
                  :key="indexs"
                  :label="items.stordocName"
                  :value="items.stordocNo"
                />
              </el-select>
            </el-form-item>
            <div class="zhu w50p">
              <el-form-item
                label="主数量&主单位 :"
                :prop="'putInStorageList.' + index + '.primaryQuantity'"
                style="width: 82%;"
                :rules="[{pattern: /^([1-9]\d*(\.\d*[1-9][0-9])?)|(0\.\d*[1-9][0-9])|(0\.\d*[1-9])$/, message:'值为大于0的数', trigger: ['change','blur']},
                         {required: true,message:'数量不能为空',trigger:'change'}]"
              >
                <el-input
                  v-model="orderDetail.primaryQuantity"
                  clearable
                  disabled
                  placeholder="主数量"
                />
              </el-form-item>
              <el-form-item
                :prop="'putInStorageList.' + index + '.unitNo'"
                :rules="[{required: true,message:'主单位不能为空',trigger:'change'}]"
                style="width: 18%;"
              >
                <el-select
                  v-model="orderDetail.unitNo"
                  placeholder="主单位"
                  disabled
                  clearable
                >
                  <el-option
                    v-for="items,indexs in unitList"
                    :key="indexs"
                    :label="items.symbol || items.unitName"
                    :value="items.unitNo"
                  />
                </el-select>
              </el-form-item>
            </div>
            <el-form-item
              label="换算率 :"
              :prop="'putInStorageList.' + index + '.exchangeRate'"
              class="w50p"
              :rules="[{pattern: /^([1-9]\d*(\.\d*[1-9][0-9])?)|(0\.\d*[1-9][0-9])|(0\.\d*[1-9])$/, message:'值为大于0的数', trigger: ['change','blur']},
                       {required: true,message:'换算率不能为空',trigger:'change'}]"
            >
              <el-input
                v-model="orderDetail.exchangeRate"
                clearable
                placeholder="请输入换算率"
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
              />
            </el-form-item>


            <el-form-item
              label="单价/元 :"
              :prop="'putInStorageList.' + index + '.price'"
              class="w50p"
              v-if="nowChanceStau!=='auditing'"
              :rules="[{pattern: /^([1-9]\d*(\.\d*[1-9][0-9])?)|(0\.\d*[1-9][0-9])|(0\.\d*[1-9])$/, message:'值为大于0的数', trigger: ['change','blur']}]"
            >
              <el-input
                v-model="orderDetail.price"
                clearable
                placeholder="请输入单价"
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
              />
            </el-form-item>
            <el-form-item
              label="总金额/元 :"
              :prop="'putInStorageList.' + index + '.totalPrice'"
              v-if="nowChanceStau!=='auditing'"
              class="w50p"
              :rules="[{pattern: /^([1-9]\d*(\.\d*[1-9][0-9])?)|(0\.\d*[1-9][0-9])|(0\.\d*[1-9])$/, message:'值为大于0的数', trigger: ['change','blur']}]"
            >
              <el-input
                v-model="orderDetail.totalPrice"
                clearable
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
                placeholder="请输入金额"
              />
            </el-form-item>
            <el-form-item
              label="生产日期 :"
              :prop="'putInStorageList.' + index + '.produceDate'"
              class="w50p"
              :rules="[{required: true,message:'生产日期不能为空',trigger:'change'}]"
            >
              <el-date-picker
                v-model="orderDetail.produceDate"
                :picker-options="produceDate(index)"
                type="date"
                value-format="yyyy-MM-dd"
                clearable
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
                placeholder="请选择时间"
              />
            </el-form-item>
            <el-form-item
              label="失效日期 :"
              :prop="'putInStorageList.' + index + '.expirationDate'"
              class="w50p"
              :rules="[{required: true,message:'失效日期不能为空',trigger:'change'}]"
            >
              <el-date-picker
                v-model="orderDetail.expirationDate"
                :picker-options="expirationDate(index)"
                type="date"
                value-format="yyyy-MM-dd"
                clearable
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
                placeholder="请选择时间"
              />
            </el-form-item>
            <el-form-item
              label="批号 :"
              v-if="nowChanceStau==='add' || nowChanceStau==='auditing'"
              :prop="'putInStorageList.' + index + '.lotNumber'"
              class="w50p"
              :rules="[{required: true,message:'批号',trigger:'change'}]"
            >
              <el-input
                v-model="orderDetail.lotNumber"
                clearable
                placeholder="请输入批号"
                :disabled="nowChanceStau === 'check'"
              />
            </el-form-item>
            <el-form-item
              label="单位 :"
              v-if="nowChanceStau==='add' || nowChanceStau==='auditing'"
              :prop="'putInStorageList.' + index + '.castUnitNo'"
              class="w50p"
              :rules="[{required: true,message:'单位不能为空',trigger:'change'}]"
            >
              <el-select
                v-model="orderDetail.castUnitNo"
                placeholder="请选择单位"
                clearable
                :disabled="nowChanceStau === 'check'"
                @change="exchangeRateToNull($event,index)"
              >
                <el-option
                  v-for="items,indexs in unitList"
                  :key="indexs"
                  :label="items.symbol || items.unitName"
                  :value="items.unitNo"
                />
              </el-select>
            </el-form-item>
            <el-form-item
              label="实收数量 :"
              v-if="nowChanceStau==='add' || nowChanceStau==='auditing'"
              :prop="'putInStorageList.' + index + '.arriveNum'"
              class="w50p numberUnit"
              :rules="[{required: true,message:'数量不能为空',trigger:'blur'},{pattern: /^\d+$/,message:'值该为正整数',trigger: ['change','blur']},
              ]"
            >
              <el-input
                v-model="orderDetail.arriveNum"
                clearable
                placeholder="请输入数量"
                :disabled="nowChanceStau === 'check'"
                class="one"
              />
              <el-select
                v-model="orderDetail.castUnitNo"
                class="two"
                placeholder="单位"
                clearable
                disabled
              >
                <el-option
                  v-for="items,indexs in unitList"
                  :key="indexs"
                  :label="items.symbol || items.unitName"
                  :value="items.unitNo"
                />
              </el-select>
            </el-form-item>


            <!-- <el-form-item
              label="件数 :"
              :prop="'putInStorageList.' + index + '.packNum'"
              class="w50p"
              :rules="[{pattern: /^\d+$/,message:'值该为正整数',trigger: ['change','blur']},]"
            >
              <el-input
                v-model="orderDetail.packNum"
                clearable
                :disabled="nowChanceStau === 'check'"
                placeholder="请输入件数"
              />
            </el-form-item>-->


            <!-- <el-form-item
              label="重量/kg :"
              :prop="'putInStorageList.' + index + '.weight'"
              class="w50p"
              :rules="[{pattern: /^[1-9]*[1-9][0-9]*$/,message:'值该大于0',trigger: ['change','blur']}]"
            >
              <el-input
                v-model="orderDetail.weight"
                clearable
                :disabled="nowChanceStau === 'check'"
                placeholder="请输入重量"
              />
            </el-form-item>-->
            <!-- <el-form-item
              label="体积/L :"
              :prop="'putInStorageList.' + index + '.volume'"
              class="w50p"
              :rules="[{pattern: /^[1-9]*[1-9][0-9]*$/,message:'值该大于0',trigger: ['change','blur']}]"
            >
              <el-input
                v-model="orderDetail.volume"
                clearable
                :disabled="nowChanceStau === 'check'"
                placeholder="请输入体积"
              />
            </el-form-item>-->
            <el-form-item
              label="入库时间 :"
              v-if="nowChanceStau==='check' || nowChanceStau==='add'"
              :prop="'putInStorageList.' + index + '.intoTime'"
              class="w50p"
              :rules="[{required: true,message:'到货不能为空',trigger:'change'}]"
            >
              <el-date-picker
                v-model="orderDetail.intoTime"
                :picker-options="putInDate(index)"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm"
                format="yyyy-MM-dd HH:mm"
                clearable
                :disabled="nowChanceStau === 'check'"
                placeholder="请选择时间"
              />
            </el-form-item>
          <!--   <el-form-item
              v-if="nowChanceStau === 'check'"
              label="审核状态 :"
              :prop="'putInStorageList.' + index + '.forderStatus'"
              class="w50p"
              :rules="[{required: true,message:'审核状态不能为空',trigger:'change'}]"
            >
              <el-select
                v-model="orderDetail.forderStatus"
                placeholder="请选择审核状态"
                clearable
              >
                <el-option
                  v-for="items,indexs in forderStatusList"
                  :key="indexs"
                  :label="items.name"
                  :value="items.value"
                />
              </el-select>
            </el-form-item> -->
            <el-form-item
              label="入库类型 :"
              :prop="'putInStorageList.' + index + '.warehousingType'"
              class="w50p"
              v-if="nowChanceStau==='add'"
              :rules="[{required: true,message:'入库类型不能为空',trigger:'change'}]"
            >
              <el-select
                v-model="orderDetail.warehousingType"
                placeholder="请选择入库类型"
                clearable
                :disabled="nowChanceStau === 'check' || nowChanceStau==='material'"
              >
                <el-option
                  v-for="items,indexs in warehousingTypeList"
                  :key="indexs"
                  :label="items.name"
                  :value="items.name"
                />
              </el-select>
            </el-form-item>
            <div
              v-if="nowChanceStau === 'add' && typeFlag === 1"
              class="editBox"
            >
              <el-button type="info" circle @click="delOrderDetail(index)">
                <i class="el-icon-minus"></i>
              </el-button>
            </div>
          </div>
          <div v-if="nowChanceStau === 'add' && typeFlag === 1">
            <el-button
              class="addone"
              type="info"
              circle
              @click="addOrderDetail"
            >
              <i class="el-icon-plus"></i>
            </el-button>
          </div>
        </el-form>
        <div v-if="nowChanceStau !== ''" slot="footer" class="dialog-footer">
          <el-button class="zh-button-one" @click="cancel('formData')">取 消</el-button>
          <el-button
          v-if="forderStatus === 0 && nowChanceStau!=='reject' && nowChanceStau!=='material'"
          class="zh-button-two" type="primary"
          @click="save('formData')">
          {{ nowChanceStau === 'add' ? '保 存' : '确认入库' }}
        </el-button>
          <el-button v-if="nowChanceStau === 'reject'" class="zh-button-two" type="primary" @click="confirm('formData')">确 定</el-button>
        </div>
      </el-dialog>
    </template>
  </BaseMainSlot>
</template>

<script src="">
import SearchForm from '@/components/searchForm';
import Table from '@/components/table/table.vue';
import ActionBar from "@/components/ActionBar";
import Pagination from "@/components/Pagination";
import BaseMainSlot from "@/components/BaseMainSlot/newBaseMainSlot";
import selectbutton from "@/components/selectbutton/index.vue";
import { mymixin } from "@/utils/mixins";
import unitApi from "@/api/basic-info-manage/unit-manage"; // 单位
import materialApi from "@/api/basic-info-manage/agr-source-base-Manage"; // 物料
import orderApi from "@/api/livestock-manage/purchaseManage/purchaseOrder"; // 订单
import orderDetailApi from "@/api/livestock-manage/purchaseManage/orderDetail"; // 订单明细
import warehouseApi from "@/api/livestock-manage/storage-manage/warehouse-manage"; // 仓库
import personApi from "@/api/livestock-manage/personnel-cost-mansge/staff-manage"; // 人员
import arrivalDetailAoi from "@/api/livestock-manage/purchaseManage/arrival-detail"; // 到货明细
import putInStorage from "@/api/livestock-manage/purchaseManage/put-in-storage"; // 入库
import nowpagereqquery from "@/api/digital-production/production-batch-manage/create-production-batch/index";
import { mapGetters } from "vuex";
export default {
  name: "SheepInformation",
  components: {
    SearchForm,
    Table,
    ActionBar,
    Pagination,
    BaseMainSlot,
    selectbutton
  },
  mixins: [mymixin],
  data() {
    return {
      searchlist: {},
      tableColumn: [],
      formConfig: [
        {
          label: '入库单号',
          prop: 'warehousingEntryNo',
          type: 'input',
        },
        {
          label: '入库形式',
          prop: 'typeFlag',
          type: 'select',
          options: [
              { name: "订单入库", value: 0 },
              { name: "自行入库", value: 1 },
              { name: "产品入库", value: 2 },
              { name: "原料入库", value: 3 },
              { name: "调拨入库", value: 4 },
              { name: "委托加工入库", value: 5 },

          ],
          optionKey: { label: 'name', value: 'value' },
        },
        {
          label: '日期选择',
          prop: 'intoTime',
          type: 'daterange',
        },
      ],
      forderStatus: 0, // 审核状态
      toAdd: {},
      typeFlag: 0,
      arrivalGoodsList: [],
      selectedStaffList: [],
      personList: [],
      unitList: [],
      stordocList: [], // 仓库
      putInorderList: [], // 入库单号
      materialList: [], // 货名
      batchNoList: [], // 批次号
      warehousingTypeList: [
        { name: "成品", value: "成品" },
        { name: "半成品", value: "半成品" },
        { name: "原材料", value: "原材料" }
      ], // 入库类型
      sourceDocTypeList: [{ name: "采购", value: "采购" }],
      sourceDocNoList: [], // 所有采购订单号
      associatedDocumentTypeList: [{ name: "采购明细", value: "采购明细" }],
      associatedDocumentNoList: [], // 单个订单所有明细
      forderStatusList: [
        { name: "未审核", value: 0 },
        { name: "审核通过", value: 1 },
        { name: "审核未通过", value: 2 }
      ],
        formData: {
          sourceDocType: "采购",
          sourceDocNo: "",
          putInStorageList: []
        },
      buttonselectlist: [
        { name: "未审核", value: 0 },
        { name: "审核通过", value: 1 },
        { name: "审核不通过", value: 2 }
      ],
      formDatalists: [
        {
          type: "input",
          prop: "warehousingEntryNo",
          selectValue: "warehousingEntryNo", // input Select Checkbox TimePicker
          typeObj: {},
          name: "入库单号",
          required: true
        },
      /*   {
          type: "Select",
          prop: "warehousingType",
          selectValue: "warehousingType",
          typeObj: {
            list: [
              { name: "成品", value: "成品" },
              { name: "半成品", value: "半成品" },
              { name: "原材料", value: "原材料" }
            ]
          },
          name: "入库类型",
          required: true
        }, */
        {
          type: "Select",
          prop: "materialName",
          selectValue: "materialNo", // input Select Checkbox TimePicker
          typeObj: {},
          name: "入库货名",
          required: true
        },
        {
          type: "Select",
          prop: "typeFlag",
          selectValue: "typeFlag",
          typeObj: {
            list: [
              { name: "订单入库", value: 0 },
              { name: "自行入库", value: 1 },
              { name: "产品入库", value: 2 },
              { name: "原料入库", value: 3 },
              { name: "调拨入库", value: 4 },
              { name: "委托加工入库", value: 5 },
            ]
          },
          name: "入库形式",
          required: true
        },
/*         {
          type: "Select",
          prop: "stordocName",
          selectValue: "stordocNo", // input Select Checkbox TimePicker
          typeObj: {},
          name: "仓库",
          required: true
        }, */

       /*  {
          type: "Select", // input Select Checkbox TimePicker
          prop: "unit",
          selectValue: "unitNo",
          typeObj: {},
          name: "主数量",
          required: true,
          notSearch: true
        },
        {
          type: "Select", // input Select Checkbox TimePicker
          prop: "castUnit",
          selectValue: "castUnitNo",
          typeObj: {},
          name: "应到数量",
          required: true,
          notSearch: true
        },
        {
          type: "input", // input Select Checkbox TimePicker
          prop: "exchangeRate",
          typeObj: {},
          name: "换算率",
          required: true
        }, */
        // {
        //   type: "input", // input Select Checkbox TimePicker
        //   prop: "shouldArriveNum",
        //   typeObj: {},
        //   name: "应到数量",
        //   required: true
        // },
        // {
        //   type: "input", // input Select Checkbox TimePicker
        //   prop: "primaryQuantity",
        //   typeObj: {},
        //   name: "主数量",
        //   required: true
        // },
      /*   {
          type: "input", // input Select Checkbox TimePicker
          prop: "price",
          typeObj: {},
          name: "单价",
          required: true
        },
        {
          type: "input", // input Select Checkbox TimePicker
          prop: "totalPrice",
          typeObj: {},
          name: "总金额",
          required: true
        }, */
        {
          type: "date", // input Select Checkbox TimePicker
          prop: "intoTime",
          typeObj: {},
          name: "入库时间",
          required: true
        },
         {
          type: "input", // input Select Checkbox TimePicker
          prop: "name",
          typeObj: {},
          name: "申请人",
          required: true
        },
        // {
        //   type: "input", // input Select Checkbox TimePicker
        //   prop: "weight",
        //   typeObj: {},
        //   name: "重量/kg",
        //   required: true
        // },
        // {
        //   type: "input", // input Select Checkbox TimePicker
        //   prop: "volume",
        //   typeObj: {},
        //   name: "体积/L",
        //   required: true
        // },
        // {
        //   type: "input", // input Select Checkbox TimePicker
        //   prop: "packNum",
        //   typeObj: {},
        //   name: "件数",
        //   required: true
        // },
/*         {
          type: "date", // input Select Checkbox TimePicker
          prop: "produceDate",
          typeObj: {},
          name: "生产日期",
          required: true
        },
        {
          type: "date", // input Select Checkbox TimePicker
          prop: "expirationDate",
          typeObj: {},
          name: "失效日期",
          required: true
        } */
      ],
      rules: {}
    };
  },
  computed: {
    ...mapGetters({
      judgePermission: "permission/judgePermission"
    })
  },
  watch: {
    dialogFormVisible(v) {
      if (v) {
        this.$nextTick(()=>{
          this.$refs.formData.clearValidate()
        })
      }
    },
    formData: {
      deep: true,
      handler(val) {
        if (val.putInStorageList) {
          val.putInStorageList.forEach((item, index) => {
            if (item.exchangeRate && item.arriveNum) {
              this.formData.putInStorageList[index].primaryQuantity =
                item.exchangeRate * item.arriveNum;
            }
          });
        }
      }
    }
  },
  created() {
    let list = []
    this.formDatalists.map(el => {
      let obj = {
        prop: el.prop, label: el.name, minWidth: '140px'
      }
      if (['typeFlag', 'castUnit', 'unit'].includes(el.prop)) {
        obj.slotName = el.prop
      } else if (el.name == '到货明细') {
        obj.slotName = viewList
      }
      list.push(obj)
    })

    list.push({ prop: 'materialInfo', label: '查看详情', slotName: 'materialInfo', width: '180' })
    list.push({ prop: 'operation', label: '操作', slotName: 'operation', width: '180' })
    this.tableColumn = list
    this.getMaterialList();
    this.getstordocList();
    this.getUnitList();
    this.getOederList();
    this.getPersonList();
    this.getSourceDocNoList();
    this.toAdd = this.$route.params;
  },
  mounted() {},
  methods: {
    putInDate(index) {
      const self = this;
      // 入库
      return {
        disabledDate(time) {
          if (self.formData.putInStorageList[index].produceDate) {
            //  如果结束时间不为空，则小于结束时间
            return (
              new Date(
                self.formData.putInStorageList[index].produceDate
              ).getTime() >= time.getTime()
            );
          } else {
            // return time.getTime() > Date.now(); // 开始时间不选时，结束时间最大值小于等于当天
            return null;
          }
        }
      };
    },
    // 限制前面日期不能低于后面日期
    produceDate(index) {
      const self = this;
      // 生产日期
      return {
        disabledDate(time) {
          if (
            self.formData.putInStorageList[index].expirationDate &&
            self.formData.putInStorageList[index].intoTime
          ) {
            let a = new Date(
              self.formData.putInStorageList[index].expirationDate
            ).getTime();
            let b = new Date(
              self.formData.putInStorageList[index].intoTime
            ).getTime();
            return a > b ? b <= time.getTime() : a <= time.getTime();
          } else if (self.formData.putInStorageList[index].expirationDate) {
            return (
              new Date(
                self.formData.putInStorageList[index].expirationDate
              ).getTime() <= time.getTime()
            );
          } else if (self.formData.putInStorageList[index].intoTime) {
            // return time.getTime() > Date.now(); // 开始时间不选时，结束时间最大值小于等于当天
            return (
              new Date(
                self.formData.putInStorageList[index].intoTime
              ).getTime() <= time.getTime()
            );
          } else {
            return null;
          }
        }
      };
    },
    expirationDate(index) {
      // 失效日期
      const self = this;
      return {
        disabledDate(time) {
          if (self.formData.putInStorageList[index].produceDate) {
            //  如果开始时间不为空，则结束时间大于开始时间
            self.time = new Date();
            return (
              new Date(
                self.formData.putInStorageList[index].produceDate
              ).getTime() >= time.getTime()
            );
          } else {
            // return time.getTime() > Date.now(); // 开始时间不选时，结束时间最大值小于等于当天
            return null;
          }
        }
      };
    },
    arrivalToputin() {
      arrivalDetailAoi
        .queryListByOrderNo(this.toAdd.arriveOrderNo)
        .then(res => {
          if (res.code === 1) {
            // this.formData.sourceDocType = "采购";
            this.$set(this.formData, 'sourceDocType', '采购')
            this.formData.sourceDocNo = res.data[0].orderNo;
            this.$set(this.formData, "arrivalGoodsList", []);
            this.arrivalGoodsList = res.data;
            this.$set(this.formData, "arrivalGoodsList", res.data);
            this.chooseGoods(res.data);
          }
        });
      this.typeFlag = 0
      this.nowChanceStau = "add";
      this.titleText = "添加入库";
      this.addActive = false;
      this.delActive = false;
      this.dialogFormVisible = true;
    },
    getEntryType(value) {
    const typeMapping = {
      0: '订单入库',
      1: '自行入库',
      2: '产品入库',
      3: '原料退库',
      4: '调拨入库',
      5: '委托加工入库',
    };

    // 使用映射返回对应的字符串，如果没有对应的值，则返回未定义的类型
    return typeMapping[value] || '未定义的类型';
  },
    // 获取源头单号
    getSourceDocNoList() {
      orderApi.conditionQuery({ forderStatus: 1 }).then(res => {
        if (res.code === 1) {
          this.sourceDocNoList = res.data;
        }
      });
    },
    // 添加一个物料单
    addOrderDetail() {
        this.formData.putInStorageList.push({
          typeFlag: this.typeFlag,
          warehousingType: "",
          stordocNo: "",
          materialNo: "",
          batchNo: "",
          lotNumber: "",
          primaryQuantity: "",
          unitNo: "",
          arriveNum: "",
          castUnitNo: "",
          exchangeRate: "",
          shouldArriveNum: "",
          price: "",
          totalPrice: "",
          intoTime: "",
          sourceDocType: "采购",
          sourceDocNo: "",
          associatedDocumentType: "采购明细",
          assassociatedDocumentNo: "",
          weight: "",
          volume: "",
          packNum: "",
          produceDate: "",
          expirationDate: "",
          forderStatus: 0,
          organizationNo: sessionStorage.organizationNo,
          key: Date.now(),
          //warehousingEntryNo: res.data
        });

    },
    // 删除一个入库单
    delOrderDetail(index) {
      console.log(this.formData.putInStorageList);
      if (this.formData.putInStorageList.length === 1) {
        return;
      } else {
        this.formData.putInStorageList.splice(index, 1);
      }
    },
    // 页面切换
    nowselectbuttonindex(index) {
      this.forderStatus = index;
      if (index === 0) {
        this.addActive = true;
      } else {
        this.addActive = false;
      }
      this.currentPage = 1;
      this.search();
    },
    // 获取所有物料
    getMaterialList() {
      materialApi.getqueryList({}).then(res => {
        if (res.code === 1) {
          this.materialList = res.data;
          this.$set(this.formDatalists[4], "typeObj", {
            list: res.data,
            listName: ["materialName", "materialNo"]
          });
          this.setOptions(this.formConfig, 'materialNo', res.data)
        }
      });
    },
    // 获取人员列表
    getPersonList() {
      personApi.getStaffListByCondition().then(res => {
        if (res.code === 1) {
          this.personList = res.data;
          let list = [];
          res.data.forEach(item => {
            list.push({
              name: item.person.name,
              value: item.personNo
            });
          });
          this.formDatalists.forEach((item, index) => {
            if (item.prop === "receiverName") {
              this.$set(this.formDatalists[index].typeObj, "list", list);
            }
          });
        }
      });
    },
    // 获取所有订单
    getOederList() {
      orderApi
        .conditionQuery({ completeStatus: false, forderStatus: 1 })
        .then(res => {
          if (res.code === 1) {
            let list = [];
            res.data.forEach(item => {
              list.push({
                name: item.orderNo,
                value: item.orderNo
              });
            });
            this.formDatalists.forEach((item, index) => {
              if (item.prop === "orderNo") {
                this.$set(this.formDatalists[index].typeObj, "list", list);
              }
            });
            this.formDatalists.forEach((item, index) => {
              if (item.prop === "personName") {
                this.$set(this.formDatalists[index].typeObj, "list", list);
              }
            });
          }
        });
    },
    // 获取仓库
    getstordocList() {
      warehouseApi.conditionQuery({}).then(res => {
        if (res.code === 1) {
          this.stordocList = res.data;
          this.formDatalists.forEach((item, index) => {
            if (item.prop === "stordocName") {
              this.$set(this.formDatalists[index], "typeObj", {
                list: res.data,
                listName: ["stordocName", "stordocNo"]
              });
            }
          });
          this.setOptions(this.formConfig, 'stordocNo', res.data)
        }
      });
    },
    // 获取单位列表X
    getUnitList() {
      unitApi.getPlantingUnitListByCondition({}).then(res => {
        if (res.code === 1) this.unitList = res.data;
      });
    },
    timeEvent(event, prop) {
      if (prop === "arriveTime") {
        this.formData.putInStorageList.forEach((item, index) => {
          this.$set(this.formData.putInStorageList[index], "arriveTime", event);
        });
      }
    },
    // 获取单个商品
    getGoods(event, index) {
      materialApi.getqueryList({ materialNo: event }).then(res => {
        this.$set(this.formData.putInStorageList[index], 'unitNo', res.data[0].unitNo)
        this.$set(this.formData.putInStorageList[index], 'castUnitNo', res.data[0].unitNo)
      });
    },
    // 选择到货商品
    chooseGoods(e) {
      this.$set(this.formData, "putInStorageList", e);
      this.formData.arrivalGoodsList[0].warehousingEntryNo = this.warehousingEntryNo;
      this.formData.putInStorageList.forEach((item, index) => {
        this.formData.putInStorageList[
          index
        ].sourceDocType = this.formData.sourceDocType;
        this.formData.putInStorageList[
          index
        ].sourceDocNo = this.formData.sourceDocNo;
        this.formData.putInStorageList[index].associatedDocumentType =
          this.formData.sourceDocType + "明细";
        this.formData.putInStorageList[index].associatedDocumentNo =
          item.orderDetailNo;
        this.$set(
          this.formData.putInStorageList[index],
          "shouldArriveNum",
          item.confirmQuantity || item.shouldArriveNum
        );
        this.$set(this.formData.putInStorageList[index], "forderStatus", 0);
        this.formData.putInStorageList[index].key = Date.now();
        this.formData.putInStorageList[index].typeFlag = this.typeFlag;
      });
    },
    // 获取订单详细列表
    getOrderDetailList(e) {
      orderDetailApi.numberQuery(e).then(res => {
        if (res.code === 1) {
          this.$set(this.formData, "arrivalGoodsList", []);
          this.arrivalGoodsList = res.data;
          this.$set(this.formData, "arrivalGoodsList", [
            this.arrivalGoodsList[0]
          ]);
          this.chooseGoods([this.arrivalGoodsList[0]]);
        }
      });
    },
    getTableDataList() {
      this.loading = true;
      let params = {
        page: this.currentPage,
        size: this.pageSize,
        organizationNo: sessionStorage.organizationNo,
        breedTypeNo: sessionStorage.breedTypeNo,
        entity: {
          forderStatus: this.forderStatus,
          ...this.searchlist,
          startTime: this.searchlist.intoTime && this.searchlist.intoTime[0],
          endTime: this.searchlist.intoTime && this.searchlist.intoTime[1],
        }
      };
      delete params.entity.intoTime;
      putInStorage.pageQuery(params).then(res => {
        this.loading = false;
        let data = res.data;
        if (data) {
          this.totalSize = data.totalElements;
          const formattedData = data.content.map(item => {
            if (item.warehousingEntryList && item.warehousingEntryList.length > 0) {
              item.materialName = item.warehousingEntryList.map(entry => entry.materialName).join(' , ');
            } else {
              item.materialName = '';
            }
            return item;
          });
          this.tableData = formattedData;
          this.addblankmet();
          this.resetActionBar();
          if (this.toAdd.isTo === "toAdd") {
            this.arrivalToputin();
          }
          this.toAdd = {};
        }
      });
    },

    handleSelectionChange(list) {
      this.selectedStaffList = [];
      this.selectedStaffList = list.map(item => item.warehousingEntryNo);
      if (this.selectedStaffList.length > 0) this.delActive = true;
      else this.delActive = false;
    },
    delmessage() {
      putInStorage
        .numberBatchDel({ noList: this.selectedStaffList })
        .then(res => {
          if (res.code === 1) {
            this.$message.success(res.msg);
            this.search();
          } else {
            this.$message.warning(res.msg || "删除失败");
          }
        });
    },
    handleDelete(val) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          putInStorage.numberDel(val).then(res => {
            if (res.code === 1) {
              this.$message.success(res.msg);
              this.search();
            } else {
              this.$message.warning(res.msg || "删除失败");
            }
          });
        })
        .catch(() => {});
    },
    changeAddWays(e) {
      this.typeFlag = e;
      if (this.typeFlag === 0) {
        this.formData = {
          sourceDocNo: "",
          sourceDocType: "采购",
          putInStorageList: []
        };
      }
      if (this.typeFlag === 1) {
        this.formData = {
          putInStorageList: [
            {
              typeFlag: this.typeFlag,
              warehousingType: "",
              stordocNo: "",
              materialNo: "",
              batchNo: "",
              lotNumber: "",
              primaryQuantity: "",
              unitNo: "",
              arriveNum: "",
              castUnitNo: "",
              exchangeRate: "",
              shouldArriveNum: "",
              price: "",
              totalPrice: "",
              intoTime: "",
              weight: "",
              volume: "",
              packNum: "",
              produceDate: "",
              expirationDate: "",
              forderStatus: 0,
              organizationNo: sessionStorage.organizationNo,
              key: Date.now()
            }
          ]
        };
      }
      // 获取入库订单编号
      nowpagereqquery.addcode("WAREHOUSING_ENTRY").then(res => {
        this.warehousingEntryNo = res.data;
        this.typeFlag === 1 && (this.formData.putInStorageList[0].warehousingEntryNo = res.data)
      });
    },
    add() {
      this.formData.putInStorageList = [];
      this.arrivalGoodsList = [];
      if (this.typeFlag === 0) {
        this.formData = {
          sourceDocNo: "",
          sourceDocType: "采购",
          putInStorageList: []
        };
      }
      if (this.typeFlag === 1) {
        this.formData = {
          putInStorageList: [
            {
              linenumber:1,
              typeFlag: this.typeFlag,
              warehousingType: "",
              stordocNo: "",
              materialNo: "",
              batchNo: "",
              lotNumber: "",
              primaryQuantity: "",
              unitNo: "",
              arriveNum: "",
              castUnitNo: "",
              exchangeRate: "",
              shouldArriveNum: "",
              price: "",
              totalPrice: "",
              intoTime: "",
              weight: "",
              volume: "",
              packNum: "",
              produceDate: "",
              expirationDate: "",
              forderStatus: 0,
              organizationNo: sessionStorage.organizationNo,
              key: Date.now()
            }
          ]
        };
      }
      // 获取入库订单编号
      nowpagereqquery.addcode("WAREHOUSING_ENTRY").then(res => {
        this.warehousingEntryNo = res.data;
      });
      this.typeFlag = 0
      this.nowChanceStau = "add";
      this.titleText = "添加入库";
      this.addActive = false;
      this.delActive = false;
      this.dialogFormVisible = true;

    },
    edit(row, e) {
      this.typeFlag = row.typeFlag;
      this.$set(this.formData,"warehousingEntryNo",row.warehousingEntryNo)
      this.$set(this.formData,"intoTime",row.intoTime)
      this.$set(this.formData,"reason",row.reason)
      this.$set(this.formData,"putInStorageList",row.warehousingEntryList)
      this.nowChanceStau = e;
      let a = e === "check" ? "入库详情" : e === "material" ? "物料详情" : e === "auditing" ? "审核" : e === "reject" ? "驳回原因" : "修改入库";
      this.titleText = a;
      this.dialogFormVisible = true;
      this.addActive = true;
      this.delActive = false;
    },
    kookInfo(e) {
      this.formData = {};
      arrivalDetailAoi.queryListByOrderNo(e).then(res => {
        if (res.code === 1) {
          this.$set(this.formData, "putInStorageList", res.data);
        }
      });
      this.nowChanceStau = "kookInfo";
      this.titleText = "查看到货明细";
      this.dialogFormVisible = true;
      this.addActive = true;
      this.delActive = false;
    },
    addDetail(e, index) {
      let validateFieldList = [];
      this.$refs["formData"].validateField(
        [
          "putInStorageList." + index + ".materialNo",
          "putInStorageList." + index + ".confirmQuantity",
          "putInStorageList." + index + ".castUnitNo",
          "putInStorageList." + index + ".unitNo",
          "putInStorageList." + index + ".exchangeRate",
          "putInStorageList." + index + ".primaryQuantity",
          "putInStorageList." + index + ".price",
          "putInStorageList." + index + ".packNum",
          "putInStorageList." + index + ".totalPrice",
          "putInStorageList." + index + ".address"
        ],
        valid => {
          if (!valid) {
            validateFieldList.push(valid);

            // 因为我这里总共校验了三个字段,所有最终三个字段都校验成功之后,数组中会有三个""
            if (
              validateFieldList.length === 10 &&
              validateFieldList.every(item => item === "")
            ) {
              orderDetailApi.add(e).then(res => {
                if (res.code === 1) {
                  this.$message.success(res.msg);
                  orderDetailApi.numberQuery(e.orderNo).then(res => {
                    this.$set(this.formData, "putInStorageList", res.data);
                  });
                } else {
                  this.$message.warning(res.msg || "添加失败");
                }
              });
            }
            // 校验不通过走这里
            return;
          } else {
            return false;
          }
        }
      );
    },
    editDetail(e) {
      this.$confirm("确定修改该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          orderDetailApi.edit(e).then(res => {
            if (res.code === 1) {
              this.$message.success(res.msg);
            } else {
              this.$message.warning(res.msg || "修改失败");
            }
          });
        })
        .catch(() => {});
    },
    delDetial(e, index) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          orderDetailApi.numberQuery(e.orderNo).then(res => {
            if (res.data.length <= 1) {
              this.$message.warning("已是最后一条数据禁止删除");
            } else {
              orderDetailApi.numberDel(e.orderDetailNo).then(res => {
                if (res.code === 1) {
                  this.$message.success(res.msg);
                  this.formData.putInStorageList.splice(index, 1);
                } else {
                  this.$message.warning(res.msg || "删除失败");
                }
              });
            }
          });
        })
        .catch(() => {});
    },
    confirm() {
        if (!this.formData.reason) {
          this.$message.error('请填写驳回原因');
          return;
        }
        this.formData.putInStorageList.reason = this.formData.reason;
        this.formData.putInStorageList = this.formData.putInStorageList.map(item => {
                return { ...item, forderStatus: 2 ,reason:this.formData.reason};
              });
        putInStorage.reject(this.formData.putInStorageList).then(res => {
          if (res.code === 1) {
            this.$message.success(res.msg || "驳回成功！");
            this.dialogFormVisible = false;
            this.search();
            this.$refs[formData].resetFields();
          } else {
            this.$message.error(res.msg || "驳回失败！");
          }
        });
      },

    cancel(){
      this.dialogFormVisible = false;
      this.formData.reason=''
    },
    save(formData) {
      this.$refs[formData].validate(valid => {
        console.log(this.nowChanceStau )
        if (valid) {
          // 添加仓库名称
          this.formData.putInStorageList.forEach((item, index) => {
            if (item.stordocNo) {
              this.stordocList.forEach(item1 => {
                if (item1.stordocNo === item.stordocNo) {
                  this.formData.putInStorageList[index].stordocName =
                    item1.stordocName;
                }
              });
            }
          });
          if (this.nowChanceStau === "edit") {
            putInStorage.edit(this.formData.putInStorageList[0]).then(res => {
              if (res.code === 1) {
                this.$message.success(res.msg || "修改成功！");
                this.dialogFormVisible = false;
                this.search();
                this.$refs[formData].resetFields();
              } else {
                this.$message.error(res.msg || "修改失败！");
              }
            });
          } else if (this.nowChanceStau === "add") {
            const name = sessionStorage.getItem('account') ;
              this.formData.putInStorageList = this.formData.putInStorageList.map(item => {
                return { ...item, name: name };
              });
             putInStorage.batchAdd(this.formData.putInStorageList).then(res => {
              if (res.code === 1) {
                this.$message.success(res.msg || "新增成功！");
                this.dialogFormVisible = false;
                this.search();
                this.$refs[formData].resetFields();
              } else {
                this.$message.error(res.msg || "新增失败！");
              }
            });
          } else if (this.nowChanceStau === "check" || this.nowChanceStau === "auditing") {
            this.formData.putInStorageList = this.formData.putInStorageList.map(item => {
                return { ...item, forderStatus: 1 };
              });
             putInStorage.check(this.formData.putInStorageList).then(res => {
              if (res.code === 1) {
                this.$message.success(res.msg || "审核成功！");
                this.dialogFormVisible = false;
                this.search();
                this.$refs[formData].resetFields();
              } else {
                this.$message.error(res.msg || "审核失败！");
              }
            });
          }else if(this.nowChanceStau==='rejection'){
            this.formData.putInStorageList.forderStatus=2
            console.log(this.formData.putInStorageList[0])
          }
        } else {
          return false;
        }
      });
    }
  }
};
</script>
<style scoped lang="scss">
@import "~@/styles/variables.scss";
::v-deep
  .el-dialog__wrapper
  .el-dialog
  .el-dialog__body
  .el-form
  .el-form-item
  .el-form-item__label {
  min-width: 140px;
}


.xunhuan {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .goods {
    width: 100%;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: left;

  }
  .editBox {
    position: absolute;
    right: 0px;
    bottom: -30px;
  }
}
.addone {
  margin-left: 140px;
}
.zhu {
  display: flex;
  ::v-deep .el-input__inner {
    background-color: rgb(241, 239, 239) !important;
  }
}
.numberUnit {
  display: flex;
  .one {
    width: 65%;
  }
  .two {
    width: 35%;
  }
}
</style>
